翻訳と辞書
Words near each other
・ "O" Is for Outlaw
・ "O"-Jung.Ban.Hap.
・ "Ode-to-Napoleon" hexachord
・ "Oh Yeah!" Live
・ "Our Contemporary" regional art exhibition (Leningrad, 1975)
・ "P" Is for Peril
・ "Pimpernel" Smith
・ "Polish death camp" controversy
・ "Pro knigi" ("About books")
・ "Prosopa" Greek Television Awards
・ "Pussy Cats" Starring the Walkmen
・ "Q" Is for Quarry
・ "R" Is for Ricochet
・ "R" The King (2016 film)
・ "Rags" Ragland
・ ! (album)
・ ! (disambiguation)
・ !!
・ !!!
・ !!! (album)
・ !!Destroy-Oh-Boy!!
・ !Action Pact!
・ !Arriba! La Pachanga
・ !Hero
・ !Hero (album)
・ !Kung language
・ !Oka Tokat
・ !PAUS3
・ !T.O.O.H.!
・ !Women Art Revolution


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

method of complements : ウィキペディア英語版
method of complements

In mathematics and computing, the method of complements is a technique used to subtract one number from another using only addition of positive numbers. This method was commonly used in mechanical calculators and is still used in modern computers.
The ''nines' complement'' of a number is formed by replacing each digit with nine minus that digit. To subtract a decimal number ''y'' (the subtrahend) from another number ''x'' (the minuend) two methods may be used:
In the first method the nines' complement of ''x'' is added to ''y''. Then the nines' complement of the result obtained is formed to produce the desired result.

In the second method the nines' complement of ''y'' is added to ''x''. If the result is positive, a leading digit '1' appears and is an end-around carry and brought to the least significant place and added. Discarding or carrying around the initial '1' is especially convenient on calculators or computers that use a fixed number of digits: there is nowhere else for it to go so it is otherwise simply lost during the calculation. The nines' complement plus one is known as the ''tens' complement.''
The method of complements can be extended to other number bases (radix(ces)); in particular, it is used on most digital computers to perform subtraction, represent negative numbers in base 2 or binary arithmetic and test underflow and overflow in calculation.
==Numeric complements==
The radix complement of an ''n'' digit number ''y'' in radix ''b'' is, by definition, b^n-y. The radix complement is most easily obtained by adding 1 to the diminished radix complement, which is (b^n-1)-y. Since (b^n-1) is the digit b-1 repeated ''n'' times (because b^n-1 = b^n-1^n = (b-1)(b^+b^+...+b+1)=(b-1)b^+...+(b-1); see also binomial numbers). The diminished radix complement of a number is found by complementing each digit with respect to b-1 (that is, subtracting each digit in ''y'' from b-1).
The subtraction of ''y'' from ''x'' may be performed as follows.
Adding the diminished radix complement of ''x'' to ''y'' results in the value b^n-1-x + y or b^n -1-(x-y) which is the diminished radix complement of x-y, except for possible padding digits b-1. The diminished radix complement of this is the value x-y. Alternatively, adding the radix complement of ''y'' to ''x'' results in the value x+b^n-y or x-y+b^n. Assuming ''y ≤ x'' , the result will always be greater or equal to b^n and dropping the initial '1' is the same as subtracting b^n, making the result x-y+b^n-b^n or just x-y, the desired result.
In the decimal numbering system, the radix complement is called the ''ten's complement'' and the diminished radix complement the ''nines' complement''. In binary, the radix complement is called the ''two's complement'' and the diminished radix complement the ''ones' complement''. The naming of complements in other bases is similar. Some people, notably Donald Knuth, recommend using the placement of the apostrophe to distinguish between the radix complement and the diminished radix complement. In this usage, the ''four's complement'' refers to the radix complement of a number in base four while ''fours' complement'' is the diminished radix complement of a number in base 5. However, the distinction is not important when the radix is apparent (nearly always), and the subtle difference in apostrophe placement is not common practice. Most writers use ''one's'' and ''nine's complement'', and many style manuals leave out the apostrophe, recommending ''ones'' and ''nines complement''.
==Decimal example==

The nines' complement of a decimal digit is the number that must be added to it to produce 9; the complement of 3 is 6, the complement of 7 is 2, and so on, see table. To form the nines' complement of a larger number, each digit is replaced by its nines' complement.
Consider the following subtraction problem:
873 (x, the minuend)
- 218 (y, the subtrahend)
The proper use of nines' complement requires no ambiguity in the sign of a written number. Ones' complement is the analogous system for binary and always has a signed bit to tell if the encoded number is positive or not. In decimal, this rule is a little different, since the most significant place has ten possible states instead of only two:
''If the most significant digit of the number is less than 5, then the number is positive''.
The number zero is not positive or negative, and the above rule says that the representation for zero doesn't begin with zero, which is not entirely true. Nines' complement, again in analogy with ones' complement for binary, has two representations of zero. Zero can be written as is, with only 0s as digits (0, 0.0, etc.), or where all the digits are 9s. 9, 9.9, 99, and even ...999.999... all represent zero; this is why negating a number by subtracting all of its digits from 9s makes sense, because 0 is represented by the 9s. Negative numbers have the appearance of "subtracting from infinity."
The significance of the rule about the most significant digit can be seen if one simply writes down a number with a leading digit that is not less than 5, such as 83. The rule says that 83 must represent a negative number. When one does the nines' complement of 83, it is:
99
- 83


抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「method of complements」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.